package org.ktjy.springbootsecurity.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class LoginController {
    @GetMapping("/toLogin")
    public String toLogin(){
        return "login";
    }

//    @Secured("ROLE_abc")
    @PreAuthorize("hasRole('abc')")
    @RequestMapping("/toMain")
    public String toMain(){
    	return "main";
    }

//    @RequestMapping("/toError")
//    public String toError(){
//        return "error";
//    }

    @GetMapping("/toMain1")
    public String toMain2(){
        return "main1";
    }
}